import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    ListedArticle:[]
  },
  getters:{
    isListed(state){
      return (id)=>{
        return state.ListedArticle.some(el => el === id)
      }
    }
  },
  mutations: {
    addListedArticle(state,{id}){
      state.ListedArticle.unshift(id)
    }
  },
  actions: {
    addListedArticle({commit},{id}){
      commit('addListedArticle',{id})
    }
  },
  modules: {
  }
})
